const state = {
    appid:123456,
    userName:'Tom',
    showLogo:false,
}
interface TypeState{
    appid?:number
    userName?:string
    showLogo?:boolean
}
interface TypeActionsParams{
    commit:any
    state:TypeState
}
const getters={
    gettersFn(params:string){
        return `This is vuex getters:${params}`
    }
}
const mutations = {
    updateUserName (state:TypeState, data:string) {
        state.userName = data
    },
}
const actions = {
    setUserName ({commit,state}:TypeActionsParams,userName:string) {
        return new Promise<void>((resolve:any, reject) => {
            setTimeout(()=>{
                // commit('updateUserName',userName)
                resolve({
                    code:'200',
                    data:{
                        info:`hello,${userName}`
                    },
                    msg:'success'
                })
            },2 * 1000)
        })
    }
}
export default {
    state,
    getters,
    mutations,
    actions,
  }